#include "ros/ros.h"
#include "std_msgs/String.h"
#include <custom_msg/RANGE.h>
#include <iomanip>
#include "commons/rabbit_consts.h"

void chatterCallback(const custom_msg::RANGEConstPtr& msg)
{
    std::cout << std::setiosflags(std::ios::fixed) << std::setprecision(7) << "range：" << msg->range <<"voltage:"<<msg->voltage<< " rate：" << msg->rate<< "\n";
}

int main(int argc, char **argv)
{
    ros::init(argc, argv, "listener_range");
    ros::NodeHandle n;
    ros::Subscriber sub = n.subscribe(TOPIC_RANGE, 1000, chatterCallback);
    ros::spin();
    return 0;
}

